let BackGround = class extends Laya.Sprite{

    constructor(speed){
        super()
        this.bg1 = new Laya.Sprite
        this.bg2 = new Laya.Sprite

        this.speed = speed

        this.l = 0

        this.init()
    }

    init(){
        // 白色
        this.bg1.loadImage("BG.png")
        // 黑色
        this.bg2.loadImage("BG.png")
        this.addChild(this.bg1)
        this.addChild(this.bg2)
   
        this.bg2.pos(0,-Laya.stage.height)

        this.run()
        Laya.timer.frameLoop(1,this,this.run)
    }

    run(){
        this.y += this.speed
        this.l += this.speed
        if(this.bg1.y + this.y >= Laya.stage.height){
            this.bg1.y -= Laya.stage.height * 2
        }
         if(this.bg2.y + this.y >= Laya.stage.height){
            this.bg2.y -= Laya.stage.height * 2
        }
    }

    stop(){
         Laya.timer.clear(this,this.run)
    }


}